import  { useEffect,useState } from 'react' 




function App(){
    const [ count, setCount ] = useState(()=>{
        return 10
    })
    useEffect(()=>{
        console.log('count',count)
    }) 
    /**
     * 1、如果是[],就只在加载的时候触发，我加减时不触发
     * 
     * 2、如果我不写第二个参数，加载时+点击时都触发
     * **/
    return (
        <>
            <div>count-{count}</div>
            <button onClick={()=>setCount(count+1)}>加一</button>
            <button onClick={()=>setCount(count-1)}>减一</button>
        </>
    )


}

export default App